/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package library.ucm;

import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import library.view.DeliveryDesk;

/**
 *
 * @author Donghui
 */
public class RefreshTableLIB {

    private static RefreshTableLIB local;
    private DefaultTableModel model;
    private JTable booklist;
    private String[] data = new String[10];
    
    public RefreshTableLIB()
    {
        booklist=DeliveryDesk.getInstance().getButtonModel().getBooklist();
        model=(DefaultTableModel)booklist.getModel();
        local=this;
    }

    public static RefreshTableLIB getInstance()
    {
        if(local==null)
        {
            local=new RefreshTableLIB();
        }
        return local;
    }

    public void initTable()
    {
        model.setRowCount(0);
    }

    public void showBook(String[] tp)
    {
        try{
        local.data=tp;
        model.addRow(data);
        booklist.invalidate();
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
    }



}
